Repository navigation
Conversation
OpenAPI 3.1 marks nullable fields with type arrays such as
["string", "null"] and nullable references with a { type: "null" }
anyOf/oneOf member. Read both the same way as 3.0's nullable: true,
which keeps working, so a 3.1 field renders as string|null rather
than string,null.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OpenAPI 3.1 specs render nullable fields wrong. 3.1 drops
nullable: trueand lists"null"in a type array instead, so a field written astype: ["string", "null"]shows up asstring,null, and a nullable reference written asanyOf: [{ $ref }, { type: "null" }]isn't recognized as nullable. Now both render the same way 3.0'snullable: truedoes:string|null,string (date-time)|null,object|nullwith the object's properties listed under it, and "Ornull." after a body's alternatives.OpenAPI 3.0's
nullable: true, including the{ nullable: true }anyOf member, still works, and a 3.0 spec renders exactly as it did in v0.6.0. A type array with several non-null types, such as["string", "integer", "null"], renders asstring|integer|null.Posit Connect needs a release with this before it can move its API spec to 3.1: https://github.com/posit-dev/connect/pull/50607.
Validation
Render Connect's spec in both versions and compare. In a Connect checkout of https://github.com/posit-dev/connect/pull/50607,
docs/api/public/openapi.jsonis 3.1, andgit show origin/main:docs/api/public/openapi.jsonis the same API in 3.0. For each spec, make a temp project with the spec atapi/openapi.jsonand this_quarto.yml:then run the pre-render script against it:
With this branch, the 3.1 spec's
api/index.qmdis byte-identical to v0.6.0's output for the 3.0 spec, and the 3.0 spec's output is byte-identical between v0.6.0 and this branch. I checked this for both Connect's public and internal specs. With v0.6.0, the 3.1 specs differ from the 3.0 output on about 3,200 (public) and 5,500 (internal) lines.🤖 Generated with Claude Code